Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency apple/swift-log to from: "1.5.2" #316

Merged
merged 1 commit into from
Mar 30, 2023

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Mar 29, 2023

Mend Renovate

This PR contains the following updates:

Package Update Change
apple/swift-log minor from: "1.4.4" -> from: "1.5.2"

Release Notes

apple/swift-log

v1.5.2

Compare Source

Primary change

Address too aggressive warning logging on LogHandlers that do not support MetadataProvider. The warning would be emitted too frequently, resulting in flooding logs with warnings. Instead, the warning is now emitted once per log handler type.

What's Changed

Full Changelog: apple/swift-log@1.5.1...1.5.2

v1.5.1

Compare Source

Summary

This patch release focuses on minor cleanups to ergonomics of setting metadata providers with the default stream log handlers, and fixes a bug in the default handler not printing the provided extra metadata by default (it does now).

Thank you to @​slashmo for quickly noticing and providing a patch for the latter!

What's Changed

Full Changelog: apple/swift-log@1.5.0...1.5.1

v1.5.0

Compare Source

Changes

Swift version support

This release drops support for Swift 5.0.

Swift 5.1+ remain supported for the time being.

Logger.MetadataProvider

This release introduces metadata providers!

They are an additional way to add metadata to your log statements automatically whenever a log statement is about to be made. This works extremely well with systems like distributed tracing, that may pick up trace identifiers and other information from the task-local context from where the log statement is being made.

The feature came with a swift evolution style proposal introduction to the "why?" and "how?" of this feature you may find interesting.

Metadata providers are used like this:

import Logging

enum Namespace { 
  @​TaskLocal static var simpleTraceID: String?
}

let simpleTraceIDMetadataProvider = Logger.MetadataProvider { 
    guard let traceID = Namespace.simpleTraceID else {
        return [:]
    }
    return ["simple-trace-id": .string(traceID)]
 }

LoggingSystem.bootstrap({ label, metadataProvider in
    myCoolLogHandler(label: label, metadataProvider: metadataProvider)
}, metadataProvider: simpleTraceIDMetadataProvider)

which in turn makes every Logger on this LoggingSystem add this contextual metadata to log statements automatically:

let log = Logger(label: "hello")

Namespace.$simpleTraceID.withValue("1234-5678") {
  test()
}

func test() {
  log.info("test log statement")
}

// [info] [simple-trace-id: 1234-5678] test log statement
Adoption in LogHandlers

In order to support this new feature in your log handlers, please make it accept a MetadataProvider? at creation, and store it as:

struct MyHandler: LogHandler {
    // ... 
    public var metadataProvider: Logger.MetadataProvider?
    // ...
}

What's Changed

Highlight
Other changes

New Contributors

Full Changelog: apple/swift-log@1.4.4...1.5.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Enabled.

Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot force-pushed the renovate/apple-swift-log-1.x branch 3 times, most recently from 255e3e7 to f00cba2 Compare March 30, 2023 05:43
@renovate renovate bot force-pushed the renovate/apple-swift-log-1.x branch from f00cba2 to e2ce277 Compare March 30, 2023 05:43
@renovate renovate bot merged commit 9dc1e00 into main Mar 30, 2023
@renovate renovate bot deleted the renovate/apple-swift-log-1.x branch March 30, 2023 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants